Adding a new function which forces the standard LP to be in a specifi…#13
Adding a new function which forces the standard LP to be in a specifi…#13kwesiRutledge merged 7 commits intomainfrom
Conversation
…c optimization sense, if it is not already.
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new method ToLPStandardForm2 to the OptimizationProblem struct that forces the standard LP to be in a specific optimization sense (maximization). The method builds upon the existing ToLPStandardForm1 functionality and ensures the resulting problem has a maximization objective.
- Added
ToLPStandardForm2method that converts problems to standard form with maximization sense - Added comprehensive test coverage for the new method
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| problem/optimization_problem.go | Implements the new ToLPStandardForm2 method that converts to standard form and forces maximization |
| testing/problem/optimization_problem_test.go | Adds test case for the new method with minimization to maximization conversion |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| // Modify the objective function to be a maximization problem, | ||
| // if it is not already. | ||
| if problemInStandardForm.Objective.Sense == SenseMinimize { |
There was a problem hiding this comment.
The objective function transformation lacks documentation explaining why the expression is multiplied by -1. This is a critical mathematical transformation that converts min c^Tx to max (-c)^Tx while preserving optimal solutions, and should be documented with a comment.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
+ Coverage 86.76% 87.44% +0.67%
==========================================
Files 27 33 +6
Lines 3687 4093 +406
==========================================
+ Hits 3199 3579 +380
- Misses 440 461 +21
- Partials 48 53 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… to respect NEW expectations of ToLPStandardForm
…c optimization sense, if it is not already.